/**
 * Copyright (c) 2008, Andrew Carter
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, are 
 * permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer. Redistributions in binary form must reproduce 
 * the above copyright notice, this list of conditions and the following disclaimer in 
 * the documentation and/or other materials provided with the distribution. Neither the 
 * name of Andrew Carter nor the names of contributors may be used to endorse or promote 
 * products derived from this software without specific prior written permission. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
 * SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.acarter.ardor3d.jtree;

import java.net.URL;

import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * 
 * @author Andrew Carter
 */
public class JTreeIcon {

	/**  */
	private static JTreeIcon instance = null;

	/**  */
	public Icon node;

	/**  */
	public Icon passNode;

	/**  */
	public Icon staticPhysicsNode;

	/**  */
	public Icon dynamicPhysicsNode;

	/**  */
	public Icon mesh;

	/**  */
	public Icon collisionGeometry;

	/**  */
	public Icon controller;

	/**  */
	public Icon controllerDisabled;

	/**  */
	public Icon renderState;

	/**  */
	public Icon renderStateDisabled;

	/**  */
	public Icon light;

	/**  */
	public Icon lightDisabled;

	/**  */
	public Icon passNodeState;

	/**  */
	public Icon passNodeStateDisabled;

	/**  */
	public Icon primitive;
	
	/**  */
	private static final String basePath = "com/acarter/ardor3d/jtree/data/";

	/**
	 * 
	 * 
	 */
	private JTreeIcon() {

		URL imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "node.png");

		if (imageURL != null)
			node = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "passnode.png");

		if (imageURL != null)
			passNode = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "staticphysicsnode.png");

		if (imageURL != null)
			staticPhysicsNode = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "dynamicphysicsnode.png");

		if (imageURL != null)
			dynamicPhysicsNode = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "mesh.png");

		if (imageURL != null)
			mesh = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "collisiongeom.png");

		if (imageURL != null)
			collisionGeometry = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "controller.png");

		if (imageURL != null)
			controller = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "controller_disabled.png");

		if (imageURL != null)
			controllerDisabled = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "renderstate.png");

		if (imageURL != null)
			renderState = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "renderstate_disabled.png");

		if (imageURL != null)
			renderStateDisabled = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "light.png");

		if (imageURL != null)
			light = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "light_disabled.png");

		if (imageURL != null)
			lightDisabled = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "passnodestate.png");

		if (imageURL != null)
			passNodeState = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "passnodestate_disabled.png");

		if (imageURL != null)
			passNodeStateDisabled = new ImageIcon(imageURL);

		imageURL = JTreeIcon.class.getClassLoader().getResource(basePath + "primitive.png");

		if (imageURL != null)
			primitive = new ImageIcon(imageURL);
	}

	/**
	 * 
	 * @return
	 */
	public static JTreeIcon getIcon() {

		if (instance == null) {
			instance = new JTreeIcon();
		}

		return instance;
	}
}
